<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>发表文章</title>
</head>
<body>
	<div class="row">
    <div class="col-lg-12 col-sm-12 col-xs-12">
        <div class="widget flat radius-bordered">
            <div class="widget-header bordered-bottom bordered-themeprimary">
                <span class="widget-caption">编辑文章</span>

                <div class="widget-buttons">
                    <a  data-toggle="maximize">
                      <i ui-sref="articleList" class="fa fa-reply">点击返回文章列表</i>
                    </a>
                </div>
            </div>
            <div class="widget-body">
              <form id="myForm" role="form" name="article" method="post" ng-submit="publish()">
                <div class="form-group col-lg-12 col-sm-12 col-xs-12" >
                    <label style="line-height:34px;" for="articleName" class="col-lg-1 col-sm-2 col-xs-3 control-label no-padding-right">文章标题</label>
                    <div class="col-lg-11 col-sm-10 col-xs-9">
                        <input name="title" required ng-model="title" type="text" class="form-control" require id="articleName" placeholder="请输入文章标题">
                    </div>
                </div>
                <div class="form-group col-lg-12 col-sm-12 col-xs-12" >
                    <label style="line-height:34px;" for="articleCover" class="col-lg-1 col-sm-2 col-xs-3 control-label no-padding-right">文章封面</label>
                    <div class="col-lg-11 col-sm-10 col-xs-9">
                        <input name="cover" accept="image/jpg,image/jpeg,image/png" ng-model="cover" type="file" class="form-control" id="articleCover" placeholder="请上传文章封面图片">
                    </div>
                </div>
                <button id="subBut" style="margin:22px auto;display:none;" type="submit" class="btn btn-lg btn-blue">确认发表</button>
              </form>
                <div class="widget-main no-padding"  style="margin-top:100px;">
                    <div id="summernote" style="display: none;"></div>
                    <button style="margin:22px auto;display:block;" ng-click="click()" class="btn btn-lg btn-blue">确认发表</button>
                </div>
            </div>
        </div>
    </div>
</div>
<!--Basic Scripts-->
    <script src="../css/assets/js/jquery-2.0.3.min.js"></script>
    <script src="../css/assets/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="http://apps.bdimg.com/libs/jqueryui/1.10.4/css/jquery-ui.min.css">
    <script src="http://apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
    <!--Beyond Scripts-->
    <script src="../css/assets/js/beyond.min.js"></script>
<script src="../css/assets/js/editors/summernote/summernote.js"></script>
<script>
  function sendFile(file,editor,editable) {
      data = new FormData();
      data.append("image", file);
      $.ajax({
          data: data,
          type: "POST",
          url: "publish_action.jsp",/*填写后台上传文件的路径*/
          cache: false,
          contentType: false,
          processData: false,
          success: function(data) {/*url为上传成功后返回的图片路径*/
              if(data.serviceResult){
                editor.insertImage(editable, data.resultParm.imageUrl);
              }
              else {
                alertMes(response.serviceResult,response.resultInfo);
              }
          }
      });
  }
  $('#summernote').summernote({
    height: 580,
    onImageUpload: function(files, editor, editable) {
      sendFile(files[0],editor,editable);
    }
  });

</script>
	
</body>
</html>